#include "CompetenceClasseBase.h"

using namespace std;

const unsigned CompetenceClasseBase::UnsignedNull( 0 );

const bool CompetenceClasseBase::BoolFalse( false );

const bool CompetenceClasseBase::BoolTrue( true );

CompetenceClasseBase::CompetenceClasseBase( const string& nomType,
					    const string& comp,
					    const string& alias,
					    const unsigned& prix )
  : ADDArticleObjet( nomType, comp, prix ), AliasNom( alias ),
    AliasDefini( alias != "" )
{}

/**
 * Constructeur de copie, permettant d'initialiser une instance à
 * partir d'une instance existance.
 *
 * @param[in] compClasse instance de CompetenceClasseBase à dupliquer.
 */
CompetenceClasseBase::CompetenceClasseBase( const CompetenceClasseBase&
					    compClasse )
  : ADDArticleObjet( compClasse ), AliasNom( compClasse.aliasNom() ),
    AliasDefini( compClasse.aliasDefini() )
{}

CompetenceClasseBase::~CompetenceClasseBase()
{}

CompetenceClasseBase&
CompetenceClasseBase::operator=( const CompetenceClasseBase& lsCompetence )
{
  this -> ADDArticleObjet::operator=( lsCompetence );

  if ( lsCompetence.aliasDefini() )
    AliasNom = lsCompetence.aliasNom();
  else
    AliasNom = "";

  AliasDefini = lsCompetence.aliasDefini();

  return *this;
}

const string& CompetenceClasseBase::aliasNom() const
{
  return aliasDefini() ? AliasNom : nom();
}

void CompetenceClasseBase::setAliasNom( const string& alias )
{
  AliasNom = alias;
  AliasDefini = true;
}

const bool& CompetenceClasseBase::aliasDefini() const
{
  return AliasDefini;
}

const bool& CompetenceClasseBase::pourcentage() const
{
  return BoolFalse;
}

const unsigned& CompetenceClasseBase::valeurBase() const
{
  return UnsignedNull;
}

const unsigned& CompetenceClasseBase::sousCategorie() const
{
  return UnsignedNull;
}

const unsigned& CompetenceClasseBase::adresseBase() const
{
  return UnsignedNull;
}

const bool& CompetenceClasseBase::sousCategorieDefinie() const
{
  return BoolFalse;
}

const bool& CompetenceClasseBase::choixExclusif() const
{
  return BoolFalse;
}

ostream& operator<<( ostream& os, const CompetenceClasseBase& lsCompetence )
{
  lsCompetence.afficherInstance( os );
  return os;
}

FlotMessage& operator<<( FlotMessage& flot,
			 const CompetenceClasseBase& lsCompetence )
{
  lsCompetence.afficherInstance( flot );
  return flot;
}
